<?php  ?>
<div class="row full_width">
    <div class="large-12 columns">

    </div>
</div>

<div class="row full_width">

    <div class="large-2 columns nav__">
        <br />
        <ul class="side-nav nav_ panel">
            <li><h5>Action</h5></li>
            <li class="divider"></li>
            <li class=""><a href="#" data-reveal-id="myModal">Add user</a></li>
            <li class=""><a href="<?php echo site_url('information/logout'); ?>">Log-out</a></li>
        </ul>
    </div>
    <br />

    <div class="large-9 push-1 columns panel">
        <h5>Manage Accounts</h5>
        <hr />
        <div class="row collapse">

            <?php if(!empty($user_account)){ ?>

            <table width="100%">
                <thead>
                <tr>
                    <th>Name</th>
                    <?php if($typeh != 1){ ?>
                    <th width="300">College</th>
                    <?php } ?>
                    <th width="150">Position</th>
                    <th width="150">Actions</th>
                </tr>
                </thead>
                <tbody>
                <?php
                    for($i = 0; $i < count($user_account) ; $i++):
                ?>

                    <tr>
                        <td><a href='<?php echo site_url('information/view_user'). '/' . $user_account[$i]['user_id']; ?>'><?php echo $user_account[$i]['fname'] . " " . $user_account[$i]['middle_initial'] . ". " . $user_account[$i]['lname']; ?></a></td>
                        <?php if($typeh != 1){ ?>
                            <td><?php echo $user_account[$i]['coll_name']; ?></td>
                        <?php } ?>
                        <td><?php echo $user_account[$i]['name_type']; ?></td>
                        <td>
                            <a href="<?php echo site_url('information/edit_user')."/".$user_account[$i]['user_id']; ?>">Edit</a>
                            <a href="<?php echo site_url('manage_account/delete_user')."/".$user_account[$i]['user_id']; ?>">Delete</a>
                        </td>
                    </tr>

                <?php endfor ?>
                </tbody>
            </table>
            <p><?php echo $links; ?></p>

            <?php }
            else{ ?>
                <p>Accounts are empty.</p>
            <?php } ?>

        </div>
    </div>

    <div id="myModal" class="reveal-modal small" data-reveal>
        <h2>Add a User</h2>
        <hr />

        <h6><strong>Account</strong></h6>

        <?php echo validation_errors(); ?>

        <?php echo form_open('manage_account/add_user', 'data-abide') ?>

        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="user">Username:<br /><small>*Required</small></label>
            </div>
            <div class="large-5 columns">
                <input type="text" id="user" name="user" value="" required=""/>
                <small class="error">Username is required.</small>
            </div>
            <div class="large-3 columns"></div>
        </div>

        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="pass">Password:</span></label>
            </div>
            <div class="large-5 columns">
                <input type="password" id="pass" name="pass"/>
                <p style="font-size:13px; color:indianred;">* If left blank, the default password will be added.</p>
            </div>
            <div class="large-3 columns"></div>
        </div>

        <hr />

        <h6><strong>Profile</strong></h6>

        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="fname">First Name:<br /><small>*Required</small></label>
            </div>
            <div class="large-5 columns">
                <input type="text" id="fname" name="fname" value="" required pattern="name_space"/>
                <small class="error">Only letters are allowed and is required.</small>
            </div>
            <div class="large-3 columns"></div>
        </div>

        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="middle_initial">Middle Initial:<br /><small>*Required</small></label>
            </div>
            <div class="large-5 columns">
                <input type="text" id="middle_initial" name="middle_initial" value="" maxlength="1" required pattern="alpha"/>
                <small class="error">Only letters are allowed and is required.</small>
            </div>
            <div class="large-3 columns"></div>
        </div>

        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="lname">Last Name:<br /><small>*Required</small></label>
            </div>
            <div class="large-5 columns">
                <input type="text" id="lname" name="lname" value="" required pattern="name_space"/>
                <small class="error">Only letters are allowed and is required.</small>
            </div>
            <div class="large-3 columns"></div>
        </div>

        <hr />

        <h6><strong>Position</strong></h6>

        <?php if($typeh == 0){ ?>
        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="college">College:</label>
            </div>
            <div class="large-5 columns" >
                <select id="college" name="college">
                    <?php foreach($college as $item): ?>
                        <option value="<?php echo $item->coll_id; ?>"><?php echo $item->coll_name; ?></option>
                    <?php endforeach ?>
                </select>
            </div>
            <div class="large-3 columns"></div>
        </div>
        <?php } ?>

        <div class="row">
            <div class="large-4 columns">
                <label class="inline" for="type">Category:</label>
            </div>
            <div class="large-5 columns">
                <select id="type" name="type">
                    <?php foreach($type as $item_type): ?>
                        <option value="<?php echo $item_type->type_no; ?>"><?php echo $item_type->name_type; ?></option>
                    <?php endforeach ?>
                </select>
            </div>
            <div class="large-3 columns"></div>
        </div>

        <input class="button small" type="submit" name="submit" value="Submit" />

        <?php echo form_close(); ?>

        <a class="close-reveal-modal">&#215;</a>
    </div>

</div>